/**
*
* @file
*		heap_leo
*
* @brief
*		Heap implementation by leo
*/
#ifndef __HEAP_LEO_H__
#define __HEAP_LEO_H__

#include "../../api/heap.h"
#include <windows.h>

class heap_leo: public heap876 {
private:
	// current volume of distributed memory
	size_t alloc_sz;
	//heap pointer
	void* heap_p;
	//we will have a simple list of regions
	struct region {
		region *next;
		region *prev;
		void* p;
		size_t size;
		int is_free;
		unsigned int tag;
	};
	
	struct region *first_region;

	HANDLE mutex;

public:
	heap_leo( size_t total, alloc_flags flag);
	~heap_leo();
	void*	alloc( size_t sz, unsigned int tag );
	void	free( void* ptr );
	void	free_all( unsigned int tag );
	size_t get_occupancy() const;
};
#endif